import React, { Component } from 'react';

class App extends Component {
  state = {
    value:'梨子'
  }

  handleChange = (e) => {
    console.log(e)
    console.log(e.target.value)
    this.setState({
      value:e.target.value
    })
  }
  render() {
    return (
      <div>
        <h1>这样写就可以获取到选中的option的value值</h1>
        <select name='' id=''  value={this.state.value} onChange={this.handleChange}>
            <option value="西瓜">西瓜</option>
            <option value="香蕉">香蕉</option>
            <option value="梨子">梨子</option>
        </select>
      </div>
    );
  }
}

export default App;
